package com.xyd.Service;

import com.xyd.bean.ParentCategory;
import com.xyd.dao.ParentCategoryMapper;
import com.xyd.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class ParentService {
    SqlSession sqlSession = SqlSessionFactoryUtil.getSqlSession();
    ParentCategoryMapper parentCategoryMapper = sqlSession.getMapper(ParentCategoryMapper.class);

    public List<ParentCategory> getAllParent(){
        return parentCategoryMapper.getAllParentCategory();
    }

    public ParentCategory getByParentid(int parentid){
        return parentCategoryMapper.getByParentid(parentid);
    }
    public int modifyParent(ParentCategory parentCategory){
        return parentCategoryMapper.updateByid(parentCategory);
    }
    public int delParent(int id){
        return parentCategoryMapper.delByParentid(id);
    }
}
